<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<%@ include file="/common/taglib.jsp" %>
<%@ include file="/common/common.jsp" %>    
<base href="<%=basePath%>">
<link rel="stylesheet" href="kindeditor/themes/default/default.css" />
<script type="text/javascript" src="kindeditor/kindeditor.js"></script>
<script type="text/javascript" src="kindeditor/lang/zh_CN.js"></script>
<title>新增装修常识</title>
<script type="text/javascript">
	KindEditor.ready(function(K) {
		var contentEditor = K.create('textarea[name="content"]', {
		    themeType : 'simple',
			width : '100%',
			height : '500px',
			uploadJson : '<%=basePath%>kindeditor/upload_json.jsp',
			fileManagerJson : '<%=basePath%>kindeditor/file_manager_json.jsp',
			allowFileManager : true,
			resizeType:0,
			afterCreate : function() {
	        	this.sync();
	        },
	        afterBlur:function(){
	            this.sync();
	        }  
		});
		var imageEditor = K.create('textarea[name="coverPhoto"]', {
			themeType : 'simple',
			width : '200px',
			height : '200px',
			uploadJson : '<%=basePath%>kindeditor/upload_json.jsp',
			fileManagerJson : '<%=basePath%>kindeditor/file_manager_json.jsp',
			allowFileManager : true,
			//allowImageRemote : false,
			items : ['image'],
			afterCreate : function() {
	        	this.sync();
	        },
	        afterBlur:function(){
	            this.sync();
	        }
		});
	});
	function check(){
		if($("#title").val() == ""){
			alert('标题不能为空！');
			return false ;
		}else if($("#image").val() == ""){
			alert('请选择您要上传的文件，图片哟！');
			return false ;
		} else if($("#content").val() == ""){
			alert('内容不能为空！');
			return false ;
		}else{
			return true ;
		}
	}
</script>
</head>
<body>
<div class="container">
<h2 class="bg-info">新增装修常识</h2>	
<form action="knowledge/knowledgeAdd.html" method="post" onsubmit="return check()">
  <div class="form-group">
    <label for="exampleInputFile">标题：</label>
    <input type="text" id="title" name="title" style="width:100%"/>
  </div>
  <div class="form-group">
    <label for="exampleInputFile">封面图片：</label>
    <textarea class="form-control" id="image" name="coverPhoto" ></textarea>
  </div>
  <div class="form-group">
    <label for="exampleInputFile">内容：</label>
    <textarea class="form-control" rows="3" id="content" name="content"></textarea>
  </div>
  <button type="submit" class="btn btn-default">保存</button>
  <button type="reset" class="btn btn-default">重置</button> <a href="main/index.html">返回主页</a>
</form>
<br/>	
</div>
</body>
</html>
